home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 8_5.lha / 8_5 / fopen.c < prev    next >
Text File  |  1993-08-08  |  467b  |  20 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. / Open a named file.
  6. / The mode can be "r", "w" or "a"
  7. ILE *fopen(const char *file, const char *fmode)
  8.  
  9.    // set the modes up
  10.    open_mode m = (*fmode == 'w') ? output :
  11.       (*fmode == 'a') ? append :
  12.                 input;
  13.  
  14.    // open the file
  15.    filebuf *st = new filebuf;
  16.    st->open((char*)file, m);
  17.  
  18.    return new FILE(st, m);
  19.  
  20.